package com.example.mybatisdemo.util;

/**
 * 错误代码枚举类
 * @author liuyingjun
 * @datetime 2018-06-22 17:18
 **/
public enum CommonResultCode implements IResultCode {

    SUCCESS(0, "success"),
    ERROR(1, "系统异常"),
    FAIL(201, "操作失败"),
    HEADER_PARAM_EMPTY(1000, "请求头必选参数为空"),
    PARAM_EMPTY(1001, "必选参数为空"),
    PARAM_ERROR(1002, "参数格式错误"),
    FILE_UPLOAD_ERROR(1003,"文件上传异常"),
    PARAM_ERROR_SPECIAL_CHAR(1004,"名称不能包含特殊字符："),
    PARAM_ERROR_ORG(1005,"组织ID参数错误"),
    PARAM_INVALID(1006, "参数无效"),
    RATE_LIMITER(1007,"系统限流，稍后重试。"),

    UNKNOWN_ERROR(9999, "系统程序异常，请稍后再试"),
    SYSTEM_ERROR_401(401, "权限不足，访问未被许可"),
    PERMISSIONS_ERROR_4001(4001, "没有权限访问该功能"),
    PERMISSIONS_ERROR_4002(4002, "没有权限访问该数据"),
    SHARE_LINK_ERROR_4003(4003, "分享链接验证失败"),
    SYSTEM_ERROR_500(500, "系统内部异常,请稍后再试"),
    REQUEST_PATH_NOT_FOUND(404, "请求路径不存在"),

    ;

    /**注意： 非公共通用的不添加在此，私有的下方到各自模块中的ErrorCodeEnum中**/

    private int code;

    private String message;

    CommonResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return this.code;
    }


    public String getMessage() {
        return message;
    }

    @Override
    public String toString() {
        return "[" + this.code + "]" + this.message;
    }
}
